Component({
	properties: {
		shows: {
			type: Boolean,
			value: false
		},
		poster: {
			type: String,
			value: ''
		},

	},

	data: {
		picTempUrl: '../../../img/act1.png',
		systemInfo1: null,
		topValue: 23,

		...getApp()
	},
	lifetimes: {

		attached: function () {
			this.systemInfo()
			// 在组件实例进入页面节点树时执行
		},
		detached: function () {
			// 在组件实例被从页面节点树移除时执行
		},
	},
	methods: {
		systemInfo() {
			let that = this
			wx.getSystemInfo({
				success: function (res) {
					let {
						screenHeight
					} = res
					if (screenHeight < 670) {
						console.log('进入');
						that.setData({
							topValue: 13
						})
					}
					console.log(res);
				},
			})

		},


		showAlert() {
			this.setData({
				shows: false
			})
			wx.setPageStyle({
				style: {
					overflow: 'auto'
				}
			})
		},
		handleSave() {
			console.log(this.data.poster);
			wx.showToast({
				title: '保存中...',
				icon: 'loading',
				mask: true,
			})
			wx.getImageInfo({
				src: this.data.poster,
				success: function (res) {
					console.log(res);
					wx.saveImageToPhotosAlbum({
						filePath: res.path,
						success: (res) => {
							wx.showToast({
								title: '保存成功，请到相册中查看'
							});
						},
						fail: (err) => {
							wx.showModal({
								title: '提示',
								content: '需要您授权保存相册',
								showCancel: false,
								success() {
									wx.openSetting({
										success(settingdata) {
											if (settingdata.authSetting['scope.writePhotosAlbum']) { //是否授权保存到相册
												wx.showModal({
													title: '提示',
													content: '获取权限成功,再次保存图片即可成功',
													showCancel: false,
												})
											} else {
												wx.showModal({
													title: '提示',
													content: '获取权限失败，无法保存到相册',
													showCancel: false,
												})
											}

										},
										complete(complet) {
											console.log("complet", complet)
										}
									})
								}
							})
						}
					})
				},
				fail(err) {
					console.log(err);
				}
			})
		},
		shareMinapp() {
			// console.log(9999);
			// return {
			// 	title: '限时特卖',
			// 	path: 'pages/index/index?data=这边可以传一些ID啥的',
			// 	imageUrl: this.picTempUrl
			// }

			// wx.downloadFile({
			// 	url: 'https://wx.qlogo.cn/mmhead/Q3auHgzwzM53pB3WFXr39IiaCwpKsbUV3ZtEu8JGicFsDLrVUd3oGY7A/64',
			// 	success: (res) => {
			// 	  wx.showShareImageMenu({
			// 		path: res.tempFilePath
			// 	  })
			// 	}
			//   })
		},
	},
	onShareAppMessage() {
		// wx.showToast({
		//   title: 'title',

		// })

		// return shareMinapp()

	}
})